//
//  TitleButton.swift
//  weibo1
//
//  Created by changhongliang on 2017/7/23.
//  Copyright © 2017年 richinfo. All rights reserved.
//

import UIKit

class TitleButton: UIButton {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        // 1.设置标题文字
        self.setTitleColor(UIColor.darkText, for: UIControlState())
        //2. 设置标题文字大小
        self.titleLabel?.font = UIFont.systemFont(ofSize: 17)
        self.setImage(UIImage(named:"navigationbar_arrow_down"), for: UIControlState())
        self.setImage(UIImage(named:"navigationbar_arrow_up"), for: UIControlState.selected)
        adjustsImageWhenHighlighted = false
    }
    
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        titleLabel?.frame.origin.x = 0;
        imageView?.frame.origin.x = titleLabel!.frame.size.width
    }

  
}
